var myHead = document.querySelector('h1');
myHead.textContent = "Hello World!";
//document.querySelector('html').onclick = function() {
//    alert("Ouch! Stop poking me!");
//}

var myImage = document.querySelector('img');

myImage.onclick = function() {
    var mySrc = myImage.getAttribute('src');
    if(mySrc === 'images/firefox-icon.png') {
        myImage.setAttribute('src', 'images/firefox-icon-huge.jpeg');
    } else {
        myImage.setAttribute('src', 'images/firefox-icon.png');
    }
}

var myButton = document.querySelector("button");

function setUserName() {
    var myName = prompt('Please enter your name');
    localStorage.setItem('name', myName);
    myHead.textContent = 'Mozillia is cool. ' + myName;
}

if(!localStorage.getItem('name')) {
    setUserName();
} else {
    var storedName = localStorage.getItem('name');
    myHead.textContent = "Mozillia is cool. " + storedName;
}       


myButton.onclick = function() {
    setUserName();
}